<template>
  <div>
    <van-sticky :offset-top="1">
      <header id="header" class="aui-bar aui-bar-nav">
          <a class="aui-pull-left" @click="back">
              <span class="iconfont icon-fanhui"></span>
          </a>
          <div class="aui-title" v-text="title"></div>
          <a class="aui-pull-right" @click="fnState">
              <span v-text="text"></span>
          </a>
      </header>
    </van-sticky>
     <router-view :key="key"></router-view>
  </div>
</template>
<script>
  export default {
    name: 'User',
    data () {
      return {
        is_show: false,
        title: '',
        text: ''
      }
    },
    updated () {
      this.title = this.$route.query.title;
      this.text = this.$route.query.text ? this.$route.query.text : ''
    },
    mounted () {
      this.title = this.$route.query.title;
      
    },
    computed: {
      key(){
        return this.$route.path + Math.random();
      }
    },
    methods: {
      fnState: function() {
        switch(this.text) {
          case '添加买号':
            this.utils.fnOpenCommon(this, {name: 'add_user', query: {title: '添加买号'}})
          break;
          case '记录':
            this.utils.fnOpenCommon(this, {name: 'recommend_list', query: {title: '推荐有奖记录'}})
          break;
          case '申请差价':
            this.utils.fnOpenCommon(this, {name: 'add_fall', query: {title: '申请订单差价'}})
          break;
        }
      }
    }
  }
</script>

<style>
</style>
